/**
 * @description 用于返回对应的组件
 * @author 大肘子
 */


import QuestionInput from "./QuestionInput";
import QuestionRadio from "./QuestionRadio";
import QuestionInfo from "./QuestionInfo";
import QuestionTitle from "./QuestionTitle";
import QuestionParagraph from "./QuestionParagraph";
import QuestionCheckbox from "./QuestionCheckbox";
import QuestionTextarea from "./QuestionTextarea";

type ComponentType = {
    fe_id: string,
    type: string,
    title: string,
    ishidden: boolean,
    props: any
}

export const getQuestionComponent = (info:ComponentType)=>{
    const {fe_id,type,ishidden,props} = info
    if(ishidden) return null
    if(type === 'questionInput'){
        return <QuestionInput fe_id={fe_id} props={props}></QuestionInput>
    }
    if(type === 'questionRadio'){
        return <QuestionRadio fe_id={fe_id} props={props}></QuestionRadio>
    }
    if(type === 'questionInfo'){
        return <QuestionInfo fe_id={fe_id} props={props}></QuestionInfo>
    }
    if(type === 'questionTitle'){
        return <QuestionTitle fe_id={fe_id} props={props}></QuestionTitle>
    }
    if(type === 'questionParagraph'){
        return <QuestionParagraph fe_id={fe_id} props={props}></QuestionParagraph>
    }
    if(type === 'questionCheckbox'){
        return <QuestionCheckbox fe_id={fe_id} props={props}></QuestionCheckbox>
    }
    if(type === 'questionTextarea'){
        return <QuestionTextarea fe_id={fe_id} props={props}></QuestionTextarea>
    }
    return null
}

